home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Adobe Air 1.5 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / collections / XMLListCollection.as < prev   
Encoding:
Text File  |  2008-10-29  |  4.2 KB  |  168 lines

  1. package mx.collections
  2. {
  3.    import mx.core.mx_internal;
  4.    
  5.    use namespace mx_internal;
  6.    
  7.    public class XMLListCollection extends ListCollectionView
  8.    {
  9.       mx_internal static const VERSION:String = "3.0.0.0";
  10.       
  11.       public function XMLListCollection(param1:XMLList = null)
  12.       {
  13.          super();
  14.          this.source = param1;
  15.       }
  16.       
  17.       public function child(param1:Object) : XMLList
  18.       {
  19.          var propertyName:Object = param1;
  20.          return execXMLListFunction(function(param1:Object):XMLList
  21.          {
  22.             return param1.child(propertyName);
  23.          });
  24.       }
  25.       
  26.       private function execXMLListFunction(param1:Function) : XMLList
  27.       {
  28.          var _loc2_:int = 0;
  29.          var _loc3_:XMLList = null;
  30.          var _loc4_:int = 0;
  31.          var _loc5_:Object = null;
  32.          if(!localIndex)
  33.          {
  34.             return param1(source);
  35.          }
  36.          _loc2_ = int(localIndex.length);
  37.          _loc3_ = new XMLList("");
  38.          _loc4_ = 0;
  39.          while(_loc4_ < _loc2_)
  40.          {
  41.             _loc5_ = localIndex[_loc4_];
  42.             _loc3_ += param1(_loc5_);
  43.             _loc4_++;
  44.          }
  45.          return _loc3_;
  46.       }
  47.       
  48.       override public function toString() : String
  49.       {
  50.          var _loc1_:* = null;
  51.          var _loc2_:int = 0;
  52.          if(!localIndex)
  53.          {
  54.             return source.toString();
  55.          }
  56.          _loc1_ = "";
  57.          _loc2_ = 0;
  58.          while(_loc2_ < localIndex.length)
  59.          {
  60.             if(_loc2_ > 0)
  61.             {
  62.                _loc1_ += "\n";
  63.             }
  64.             _loc1_ += localIndex[_loc2_].toString();
  65.             _loc2_++;
  66.          }
  67.          return _loc1_;
  68.       }
  69.       
  70.       public function text() : XMLList
  71.       {
  72.          return execXMLListFunction(function(param1:Object):XMLList
  73.          {
  74.             return param1.text();
  75.          });
  76.       }
  77.       
  78.       public function toXMLString() : String
  79.       {
  80.          var _loc1_:* = null;
  81.          var _loc2_:int = 0;
  82.          if(!localIndex)
  83.          {
  84.             return source.toXMLString();
  85.          }
  86.          _loc1_ = "";
  87.          _loc2_ = 0;
  88.          while(_loc2_ < localIndex.length)
  89.          {
  90.             if(_loc2_ > 0)
  91.             {
  92.                _loc1_ += "\n";
  93.             }
  94.             _loc1_ += localIndex[_loc2_].toXMLString();
  95.             _loc2_++;
  96.          }
  97.          return _loc1_;
  98.       }
  99.       
  100.       public function copy() : XMLList
  101.       {
  102.          return execXMLListFunction(function(param1:Object):XMLList
  103.          {
  104.             return XMLList(param1.copy());
  105.          });
  106.       }
  107.       
  108.       public function set source(param1:XMLList) : void
  109.       {
  110.          if(list)
  111.          {
  112.             XMLListAdapter(list).source = null;
  113.          }
  114.          list = new XMLListAdapter(param1);
  115.       }
  116.       
  117.       public function attributes() : XMLList
  118.       {
  119.          return execXMLListFunction(function(param1:Object):XMLList
  120.          {
  121.             return param1.attributes();
  122.          });
  123.       }
  124.       
  125.       [Bindable("listChanged")]
  126.       public function get source() : XMLList
  127.       {
  128.          return !!list ? XMLListAdapter(list).source : null;
  129.       }
  130.       
  131.       public function attribute(param1:Object) : XMLList
  132.       {
  133.          var attributeName:Object = param1;
  134.          return execXMLListFunction(function(param1:Object):XMLList
  135.          {
  136.             return param1.attribute(attributeName);
  137.          });
  138.       }
  139.       
  140.       public function descendants(param1:Object = "*") : XMLList
  141.       {
  142.          var name:Object = param1;
  143.          return execXMLListFunction(function(param1:Object):XMLList
  144.          {
  145.             return param1.descendants(name);
  146.          });
  147.       }
  148.       
  149.       public function elements(param1:String = "*") : XMLList
  150.       {
  151.          var name:String = param1;
  152.          return execXMLListFunction(function(param1:Object):XMLList
  153.          {
  154.             return param1.elements(name);
  155.          });
  156.       }
  157.       
  158.       public function children() : XMLList
  159.       {
  160.          return execXMLListFunction(function(param1:Object):XMLList
  161.          {
  162.             return param1.children();
  163.          });
  164.       }
  165.    }
  166. }
  167.  
  168.